﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoMapper;
using Sahit.iSoilHotel.Portal.ServiceProxy.Models.Tavern.Record;
using Sahit.iSoilHotel.Portal.ServiceProxy;
using Sahit.iSoilHotel.Infrastructure.Crosscutting.Adapter;
using Sahit.iSoilHotel.Portal.ServiceProxy.Models.Tavern.Room;
using Sahit.iSoilHotel.Portal.ServiceProxy.Models.Tavern.Customer;
using Sahit.iSoilHotel.Portal.ServiceProxy.Models.Tavern.Price;
using RecordServiceReference = Sahit.iSoilHotel.Portal.ServiceProxy.TavernRecordServiceReference;
using RoomServiceReference = Sahit.iSoilHotel.Portal.ServiceProxy.TavernRoomServiceReference;
using PriceServiceReference = Sahit.iSoilHotel.Portal.ServiceProxy.TavernPriceServiceReference;
using Sahit.iSoilHotel.Portal.ServiceProxy.Models.Tavern.Filter;
using Webdiyer.WebControls.Mvc;

namespace Sahit.iSoilHotel.Portal.Framework
{
    public class SoilMapper
    {
        public SoilMapper()
        {
            
            #region RecordServiceReference

            Mapper.CreateMap<EntityModel, RecordServiceReference.DTOBase>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<RecordModel, RecordServiceReference.RecordDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<RoomModel, RecordServiceReference.RoomDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<RoomTypeModel, RecordServiceReference.RoomTypeDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<CustomerModel, RecordServiceReference.CustomerDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<PriceModel, RecordServiceReference.PriceDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<PriceCodeModel, RecordServiceReference.PriceCodeDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<RecordFilterModel, RecordServiceReference.RecordFilterDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));

            Mapper.CreateMap<RecordServiceReference.DTOBase,EntityModel>().ForMember(dest=>dest.ID,opt=>opt.MapFrom(s=>s.IDk__BackingField));
            Mapper.CreateMap<RecordServiceReference.RecordDTO, RecordModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RecordServiceReference.RoomDTO, RoomModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RecordServiceReference.RoomTypeDTO, RoomTypeModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RecordServiceReference.CustomerDTO, CustomerModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RecordServiceReference.PriceDTO, PriceModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RecordServiceReference.PriceCodeDTO, PriceCodeModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RecordServiceReference.RecordFilterDTO, RecordFilterModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));

            #endregion

            #region RoomServiceReference

            Mapper.CreateMap<EntityModel, RoomServiceReference.DTOBase>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<RoomTypeModel, RoomServiceReference.RoomTypeDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<RoomFilterModel, RoomServiceReference.RoomFilterDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<RoomModel, RoomServiceReference.RoomDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<BuildingModel, RoomServiceReference.BuildingDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));

            Mapper.CreateMap<RoomServiceReference.DTOBase, EntityModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RoomServiceReference.RoomTypeDTO, RoomTypeModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RoomServiceReference.RoomFilterDTO, RoomFilterModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RoomServiceReference.RoomDTO, RoomModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<RoomServiceReference.BuildingDTO, BuildingModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));

            #endregion

            #region PriceServiceReference

            Mapper.CreateMap<EntityModel, PriceServiceReference.DTOBase>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));
            Mapper.CreateMap<PriceCodeModel, PriceServiceReference.PriceCodeDTO>().ForMember(dest => dest.IDk__BackingField, opt => opt.MapFrom(s => s.ID));

            Mapper.CreateMap<PriceServiceReference.DTOBase, EntityModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            Mapper.CreateMap<PriceServiceReference.PriceCodeDTO, PriceCodeModel>().ForMember(dest => dest.ID, opt => opt.MapFrom(s => s.IDk__BackingField));
            #endregion
        }
    }
}
